import React, {useState} from 'react';
import {Tabs} from "antd";
import Tab1 from './components/edit/tab-1';
import Tab11 from './components/edit/tab-1-1';
import Tab2 from './components/edit/tab-2';
import Tab3 from './components/edit/tab-3';
import Tab4 from './components/edit/tab-4';

const { TabPane } = Tabs;

const Edit = (props) => {
    const {close, refresh, id, setId, tab,house, change} = props;
    const [tabsCur, setTabsCur] = useState(tab || '1');

    return (
        <React.Fragment>
            <div className="Building-Edit Edit page">
                {
                    <Tabs size="large" activeKey={tabsCur} onTabClick={e => setTabsCur(e)}>
                        <TabPane tab="楼盘" key="1">
                            <Tab1 change={change} id={id} close={close} refresh={refresh} setId={setId}/>
                        </TabPane>
                        <TabPane tab="楼盘(续)" key="2" disabled={!id}>
                            <Tab11 change={change} id={id} close={close} refresh={refresh} setId={setId}/>
                        </TabPane>
                        <TabPane tab="栋座" key="3" disabled={!id}>
                            <Tab2 id={id} house={house}/>
                        </TabPane>
                        <TabPane tab="学校" key="4" disabled={!id}>
                            <Tab3 id={id}/>
                        </TabPane>
                        <TabPane tab="定位" key="5" disabled={!id}>
                            <Tab4 change={change} id={id} close={close}/>
                        </TabPane>
                    </Tabs>
                }
            </div>
        </React.Fragment>
    );
}
export default Edit;